using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialAnalystTools._Generalization
{
    /// <summary>
    /// <para>Nibble</para>
    /// <para>Replaces cells of a raster corresponding to a mask with the values of the nearest neighbors.</para>
    /// <para>将与蒙版对应的栅格像元替换为最近邻的值。</para>
    /// </summary>    
    [DisplayName("Nibble")]
    public class Nibble : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Nibble()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input raster</para>
        /// <para><xdoc>
        ///   <para>The input raster that will be nibbled.</para>
        ///   <para>The input raster can be either integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将被蚕食的输入栅格。</para>
        ///   <para>输入栅格可以是整数类型，也可以是浮点类型。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_in_mask_raster">
        /// <para>Input raster mask</para>
        /// <para><xdoc>
        ///   <para>The raster used as the mask.</para>
        ///   <para>Cells that are NoData in the mask raster identify the cells in the Input raster that will be nibbled, or replaced, by the value of the closest nearest neighbour.</para>
        ///   <para>The mask raster can be either integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用作蒙版的栅格。</para>
        ///   <para>掩模栅格中属于 NoData 的像元用于标识输入栅格中将被最近最近邻的值吞噬或替换的像元。</para>
        ///   <para>蒙版栅格可以是整数类型，也可以是浮点类型。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_raster">
        /// <para>Output raster</para>
        /// <para><xdoc>
        ///   <para>The output nibbled raster.</para>
        ///   <para>The identified input cells will be replaced with the values of their nearest neighbors.</para>
        ///   <para>If the Input raster is integer, the output raster will be integer. If it is floating point, the output will be floating point.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出蚕食栅格。</para>
        ///   <para>已识别的输入单元格将替换为其最近邻居的值。</para>
        ///   <para>如果输入栅格为整数，则输出栅格将为整数。如果是浮点，则输出将是浮点。</para>
        /// </xdoc></para>
        /// </param>
        public Nibble(object _in_raster, object _in_mask_raster, object _out_raster)
        {
            this._in_raster = _in_raster;
            this._in_mask_raster = _in_mask_raster;
            this._out_raster = _out_raster;
        }
        public override string ToolboxName => "Spatial Analyst Tools";

        public override string ToolName => "Nibble";

        public override string CallName => "sa.Nibble";

        public override List<string> AcceptEnvironments => ["autoCommit", "cellSize", "cellSizeProjectionMethod", "compression", "configKeyword", "extent", "geographicTransformations", "mask", "outputCoordinateSystem", "parallelProcessingFactor", "scratchWorkspace", "snapRaster", "tileSize", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _in_mask_raster, _out_raster, _nibble_values.GetGPValue(), _nibble_nodata.GetGPValue(), _in_zone_raster];

        /// <summary>
        /// <para>Input raster</para>
        /// <para><xdoc>
        ///   <para>The input raster that will be nibbled.</para>
        ///   <para>The input raster can be either integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将被蚕食的输入栅格。</para>
        ///   <para>输入栅格可以是整数类型，也可以是浮点类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Input raster mask</para>
        /// <para><xdoc>
        ///   <para>The raster used as the mask.</para>
        ///   <para>Cells that are NoData in the mask raster identify the cells in the Input raster that will be nibbled, or replaced, by the value of the closest nearest neighbour.</para>
        ///   <para>The mask raster can be either integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用作蒙版的栅格。</para>
        ///   <para>掩模栅格中属于 NoData 的像元用于标识输入栅格中将被最近最近邻的值吞噬或替换的像元。</para>
        ///   <para>蒙版栅格可以是整数类型，也可以是浮点类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input raster mask")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_mask_raster { get; set; }


        /// <summary>
        /// <para>Output raster</para>
        /// <para><xdoc>
        ///   <para>The output nibbled raster.</para>
        ///   <para>The identified input cells will be replaced with the values of their nearest neighbors.</para>
        ///   <para>If the Input raster is integer, the output raster will be integer. If it is floating point, the output will be floating point.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出蚕食栅格。</para>
        ///   <para>已识别的输入单元格将替换为其最近邻居的值。</para>
        ///   <para>如果输入栅格为整数，则输出栅格将为整数。如果是浮点，则输出将是浮点。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_raster { get; set; }


        /// <summary>
        /// <para>Use NoData values if they are the nearest neighbor</para>
        /// <para><xdoc>
        ///   <para>Specifies whether NoData cells in the input raster are allowed to nibble into the area defined by the mask raster.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Both NoData and data values can nibble into areas defined in the mask raster. NoData values in the input raster are free to nibble into areas defined in the mask if they are the nearest neighbor. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Only data values are free to nibble into areas defined in the mask raster. NoData values in the input raster are not allowed to nibble into areas defined in the mask raster even if they are the nearest neighbor.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否允许输入栅格中的 NoData 像元啃入掩膜栅格定义的区域。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - NoData 和数据值都可以蚕食掩模栅格中定义的区域。如果输入栅格中的 NoData 值是最近的相邻区域，则可以自由地啃食掩膜中定义的区域。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 只有数据值可以自由地啃入掩模栅格中定义的区域。输入栅格中的 NoData 值不允许啃食掩码栅格中定义的区域，即使它们是最近的邻居。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Use NoData values if they are the nearest neighbor")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _nibble_values_value _nibble_values { get; set; } = _nibble_values_value._true;

        public enum _nibble_values_value
        {
            /// <summary>
            /// <para>ALL_VALUES</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ALL_VALUES")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>DATA_ONLY</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DATA_ONLY")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Nibble NoData cells</para>
        /// <para><xdoc>
        ///   <para>Specifies whether NoData cells in the input raster that are within the mask will remain NoData in the output raster.</para>
        ///   <bulletList>
        ///     <bullet_item>Unchecked—NoData cells in the input raster that are within the mask will remain NoData in the output. This is the default.</bullet_item><para/>
        ///     <bullet_item>Checked—NoData cells in the input raster that are within the mask can be nibbled into valid output cell values.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定输入栅格中位于掩膜内的 NoData 像元是否仍保留在输出栅格中的 NoData。</para>
        ///   <bulletList>
        ///     <bullet_item>未选中 - 输入栅格中位于掩膜内的 NoData 像元将保留输出中的 NoData。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>选中 - 可以将输入栅格中位于掩膜内的 NoData 像元合并为有效的输出像元值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Nibble NoData cells")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _nibble_nodata_value _nibble_nodata { get; set; } = _nibble_nodata_value._false;

        public enum _nibble_nodata_value
        {
            /// <summary>
            /// <para>PRESERVE_NODATA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("PRESERVE_NODATA")]
            [GPEnumValue("false")]
            _false,

            /// <summary>
            /// <para>PROCESS_NODATA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("PROCESS_NODATA")]
            [GPEnumValue("true")]
            _true,

        }

        /// <summary>
        /// <para>Input zone raster</para>
        /// <para><xdoc>
        ///   <para>The input zone raster. For each zone, input cells that are within the mask will be replaced only by the nearest cell values within that same zone.</para>
        ///   <para>A zone is all the cells in a raster that have the same value, whether or not they are contiguous. The input zone layer defines the shape, values, and locations of the zones. The zone raster can be either integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输入区域栅格。对于每个区域，掩码内的输入像元将仅替换为同一区域内最接近的像元值。</para>
        ///   <para>区域是栅格中具有相同值的所有像元，无论它们是否连续。输入区域图层用于定义区域的形状、值和位置。区域栅格可以是整数类型，也可以是浮点类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input zone raster")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _in_zone_raster { get; set; } = null;


        public Nibble SetEnv(int? autoCommit = null, object cellSize = null, object compression = null, object configKeyword = null, object extent = null, object geographicTransformations = null, object mask = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object snapRaster = null, double[] tileSize = null, object workspace = null)
        {
            base.SetEnv(autoCommit: autoCommit, cellSize: cellSize, compression: compression, configKeyword: configKeyword, extent: extent, geographicTransformations: geographicTransformations, mask: mask, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, tileSize: tileSize, workspace: workspace);
            return this;
        }

    }

}